package com.chaychan.bottombarlayout_ohos.slice;

import com.airbnb.lottie.LottieAnimationView;
import com.airbnb.lottie.value.LottieAnimationViewData;
import com.chaychan.bottombarlayout_ohos.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.ability.fraction.Fraction;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.Text;
import ohos.global.resource.RawFileEntry;
import ohos.global.resource.Resource;

import java.io.IOException;

public class TabFragment  extends Fraction {

    private Component mComponent;
    private AbilitySlice slice;
    private String title;



    public TabFragment(AbilitySlice slice,String title) {
        this.slice = slice;
        this.title = title;

    }

    @Override
    protected Component onComponentAttached(LayoutScatter scatter, ComponentContainer container, Intent intent) {
        mComponent = scatter.parse(ResourceTable.Layout_fraction_tab, container, false);
        // 初始化组件
        initComponent();
        return mComponent;
    }

    private void initComponent() {
       Text text = (Text) mComponent.findComponentById(ResourceTable.Id_text);
        text.setText(title);
    }
}
